Add support for Physical KASLR#590
Conversation
| } | ||
| // Allocator potentially calling allocator is risky, but i'll just say it'll | ||
| // be *fine* for now since this is only used for PKASLR | ||
| uint64_t slot = (total_slots * (uint64_t)(rand32())) >> 32; |
There was a problem hiding this comment.
why did you use this symbol? it's a S3 export and you're modifying S2 code.
There was a problem hiding this comment.
Seemed to be the most appropriate option, don't know what to replace with(don't want to roll my own crypto).
There was a problem hiding this comment.
rand32() is actually not (cryptographically) safe in the slightest; it's Mersenne Twister. hmm...
There was a problem hiding this comment.
I recommend pulling your fork and using newly exposed HW randomness instead.
There was a problem hiding this comment.
Did that, still has the s3/s2 problem, and i don't know how to fix that besides copying the allocation function into pmm.c, or rolling my own PRNG. Neither of which i want to do.
There was a problem hiding this comment.
Perhaps renaming rand.c to rand.s2.c would help fix this? the MT19937 should go anyway and be replaced by some LCG.
There was a problem hiding this comment.
Seems to build now, at least. Not sure if that's the best solution but if it works it works ig.
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
Signed-off-by: NOTMASTER08 <41077257+NOTMASTER08@users.noreply.github.com>
The limine protocol already doesn't give any guarantees about physical load address, all that's left is to just randomize the physical load address as well if kaslr is enabled.